package com.example.carapi.mapper;

import com.example.carapi.bean.CarLike;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface CarLikeMapper {
    @Select("select *\n" +
            "from car_like\n" +
            "where id=#{id}")
    CarLike getOne(@Param("id") Long id);

    @Select("select *\n" +
            "from car_like")
    List<CarLike> getAll();

    @Insert("insert\n" +
            "into car_like\n" +
            "values(user_id=#{user_id}, model_id=#{model_id})")
    void insert(CarLike carLike);

    @Update("update car_like\n" +
            "set user_id=#{user_id}, model_id=#{model_id}\n" +
            "where id=#{id}")
    void update(CarLike carLike);

    @Delete("delete\n" +
            "from car_like\n" +
            "where id=#{id}")
    void delete(@Param("id") Long id);
}
